package com.ruoyi.mapper;

import com.ruoyi.pojo.Prize;
import com.ruoyi.vo.SigninRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AppMapper {
    @Select("SELECT s.*,us.uid FROM signin s LEFT JOIN user_signin us ON s.sid = us.sid WHERE us.uid = #{user_id} or ISNULL(us.uid)")
    List<SigninRecord> siginRecordLisr(@Param("user_id") Integer user_id);

    @Select("SELECT COUNT(s.sid) FROM signin s LEFT JOIN user_signin us ON s.sid = us.sid WHERE us.uid = #{uid} AND us.sid = #{sid};")
    Integer signinRecord(@Param("uid") Integer uid,@Param("sid") Integer sid);

    @Select("SELECT * FROM prize WHERE pnum > 0")
    List<Prize> prizeNoZero();
}
